﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.DataBase
{
    public partial class sqlite : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string type = "A";
            switch (type)
            {
                case "A":
                    A();
                    break;
                case "B":
                    B();
                    break;
                case "C":
                    C();
                    break;
                case "D":
                    D();
                    break;
                default: break;
            }
        }
        //Replace(string input, string pattern, string replacement)
        private void A()
        {
            string providerName = "";
            string conn = MSL.Utility.Config.Helper.GetProviderApp("ConnectionString", out providerName);
            int num = 0;
            DataTable dt = null;// MSL.DataBase.DbHelper.Query(conn, "SELECT TOP 100 id,name,summary,workOrgan,duty,photoPath FROM PeopleAll", false);
            dt = MSL.DataBase.DbHelper.Query(conn,
                "PeopleAll",
                "ID",
                "id,name,summary,peopleCode,workOrgan,duty,photoPath",
                2,
                100,
                "deleteFlag is null",
                "peopleCode desc ",
                null,
                out num);
            conn = String.Format(MSL.Utility.Config.Helper.GetProviderApp("Conn_Sqlite", out providerName), Server.MapPath("~/App_Data"));
            string sql = "";

            foreach (DataRow dr in dt.Rows)
            {
                string id = dr["id"].ToString();
                string peopleCode = dr["peopleCode"].ToString();
                string summary = dr["summary"].ToString();
                string workOrgan = dr["workOrgan"].ToString();
                string name = dr["name"].ToString();
                string duty = dr["duty"].ToString();
                string photoPath = dr["photoPath"].ToString();

                sql = "insert into PeopleAll(id,peopleCode,summary,workOrgan,name,duty,photoPath) values(" + id + ",'" + peopleCode + "','" + summary + "','" + workOrgan + "','" + name + "','" + duty + "','" + photoPath + "')";
                MSL.DataBase.DbHelper.ExecSql(conn, sql);
            }

        }
        //
        private void B()
        {

        }
        //
        private void C()
        {
        }
        private void D()
        {

        }
        private void E()
        {

        }
    }
}